package team.southcat.wsyygh.common.config;

import team.southcat.wsyygh.model.pojo.user.Admin;

/**
 * 基于ThreadLocal封装工具类，管理员保存和获取当前管理员
 */
public class BaseContext {
    private static ThreadLocal<Admin> threadLocal = new ThreadLocal<>();

    /**
     * 设置值
     * @param admin
     */
    public static void setCurrentId(Admin admin){
        threadLocal.set(admin);
    }

    /**
     * 获取值
     * @return
     */
    public static Admin getCurrentId(){
        return threadLocal.get();
    }
}